﻿//using SXT.DB;
//using SXT.Party.Join.Model;
//using SXT.Party.JoinParty.BLL;
//using SXT.Party.JoinParty.Model;
//using System;
//using System.Collections.Generic;
//using System.Data;
//using System.Data.SqlClient;
//using System.Linq;
//using System.Text;
//using System.Web;

//namespace ZHDJ.MobileInterface.Common
//{
//    public class ApplyJoinPartyHelper
//    {
//        /// <summary>
//        /// 通过用户ID判断是否可以提交入党申请
//        /// </summary>
//        /// <param name="LoginID">用户登陆ID</param>
//        /// <returns></returns>
//        public static bool IsNewApplyByLoginID(string LoginID)
//        {
//            bool result = true;
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                cmd.CommandText = @"select count(*) from tblPartyJoinApplycation where LoginID=@LoginID and Status<>@Status ";
//                cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value = LoginID;
//                cmd.Parameters.Add("@Status", SqlDbType.Int).Value = (int)Enum_ApplyStatus.申请取消;
//                object obj = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);
//                if (obj != null)
//                {
//                    result = Convert.ToInt16(obj) < 1;
//                }
//            }
//            return result;
//        }

//        /// <summary>
//        /// 判断是否已经存在此组织成员
//        /// </summary>
//        /// <param name="LoginID">登陆ID</param>
//        /// <returns></returns>
//        public static bool IsExistOrgMember(string LoginID)
//        {
//            bool result = false;
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                cmd.CommandText = @"select count(*) from tblPartyOrgMembers where LoginID=@LoginID";
//                cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value = LoginID;
//                object obj = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);
//                if (obj != null)
//                {
//                    result = Convert.ToInt16(obj) > 0;
//                }
//            }
//            return false;
//        }

//        /// <summary>
//        /// 更新申请入党用户信息
//        /// </summary>
//        /// <param name="param">申请入党用户信息</param>
//        public static bool UpdateOrgMember(ApplyJoinPartyInParam param)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                StringBuilder sbsql = new StringBuilder();
//                sbsql.Append(@"update tblPartyOrgMembers 
//                                    set BranchID=@BranchID , Gender=@Gender , IdentityCard=@IdentityCard 
//                                     , Birthday=@Birthday , Nation=@Nation , NativePlace=@NativePlace 
//                                     , Educational=@Educational , MobileNo=@MobileNo, Address=@Address 
//                                    where LoginID=@LoginID");

//                cmd.Parameters.Add("@BranchID", SqlDbType.NVarChar).Value = param.BranchID;
//                cmd.Parameters.Add("@Gender", SqlDbType.NVarChar).Value = param.Gender;
//                cmd.Parameters.Add("@IdentityCard", SqlDbType.NVarChar).Value = param.IdentityCard;
//                cmd.Parameters.Add("@Birthday", SqlDbType.DateTime).Value = param.Birthday;
//                cmd.Parameters.Add("@Nation", SqlDbType.NVarChar).Value = param.Nation;
//                cmd.Parameters.Add("@NativePlace", SqlDbType.NVarChar).Value = param.NativePlace;
//                cmd.Parameters.Add("@Educational", SqlDbType.NVarChar).Value = param.Educational;
//                cmd.Parameters.Add("@MobileNo", SqlDbType.NVarChar).Value = param.MobileNo;
//                cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = param.Address;
//                cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value = param.LoginID;
//                cmd.CommandText = sbsql.ToString();
//                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
//            }
//        }

//        /// <summary>
//        /// 插入申请入党用户信息
//        /// </summary>
//        /// <param name="param">申请入党用户信息</param>
//        /// <returns></returns>
//        public static bool InsertOrgMember(ApplyJoinPartyInParam param)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                cmd.CommandText = @"Insert into tblPartyOrgMembers 
//                                    (LoginID,BranchID,Gender,IdentityCard,Birthday,Nation,NativePlace,Educational
//                                      ,MobileNo,Email,QQNumber,feitionNo,Address) 
//                                     values 
//                                    (@LoginID,@BranchID,@Gender,@IdentityCard,@Birthday,@Nation,@NativePlace,@Educational
//                                      ,@MobileNo,@Email,@QQNumber,@feitionNo,@Address)";
//                cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value = param.LoginID;
//                cmd.Parameters.Add("@BranchID", SqlDbType.NVarChar).Value = param.BranchID;
//                cmd.Parameters.Add("@Gender", SqlDbType.NVarChar).Value = param.Gender;
//                cmd.Parameters.Add("@IdentityCard", SqlDbType.NVarChar).Value = param.IdentityCard;
//                cmd.Parameters.Add("@Birthday", SqlDbType.DateTime).Value = param.Birthday;
//                cmd.Parameters.Add("@Nation", SqlDbType.NVarChar).Value = param.Nation;
//                cmd.Parameters.Add("@NativePlace", SqlDbType.NVarChar).Value = param.NativePlace;
//                cmd.Parameters.Add("@Educational", SqlDbType.NVarChar).Value = param.Educational;
//                cmd.Parameters.Add("@MobileNo", SqlDbType.NVarChar).Value = param.MobileNo;
//                cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = param.Email;
//                cmd.Parameters.Add("@QQNumber", SqlDbType.NVarChar).Value = param.QQNumber;
//                cmd.Parameters.Add("@feitionNo", SqlDbType.NVarChar).Value = param.feitionNo;
//                cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = param.Address;
//                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
//            }
//        }

//        /// <summary>
//        /// 插入入党申请数据
//        /// </summary>
//        /// <param name="param">申请入党信息</param>
//        /// <returns></returns>
//        public static bool InsertApply(ApplyJoinPartyInParam param)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {

//                cmd.CommandText = @"Insert into tblPartyJoinApplycation 
//                                    (AppllicationID,Content,StudyyAndWorkCompany,WorkAddress,BranchID,LoginID,UserName,CreateTime,Status,CreateUserID) 
//                                      values 
//                                    (@AppllicationID,@Content,@StudyyAndWorkCompany,@WorkAddress,@BranchID,@LoginID,@UserName,@CreateTime,@Status,@CreateUserID)";
//                cmd.Parameters.Add("@AppllicationID", SqlDbType.NVarChar).Value = param.AppllicationID;
//                if (string.IsNullOrEmpty(param.Content))
//                { param.Content = ""; }
//                cmd.Parameters.Add("@Content", SqlDbType.NVarChar).Value = param.Content;
//                cmd.Parameters.Add("@StudyyAndWorkCompany", SqlDbType.NVarChar).Value = param.StudyyAndWorkCompany;
//                cmd.Parameters.Add("@WorkAddress", SqlDbType.NVarChar).Value = param.WorkAddress;
//                cmd.Parameters.Add("@BranchID", SqlDbType.NVarChar).Value = param.BranchID;
//                cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value = param.LoginID;
//                cmd.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = param.UserName;
//                cmd.Parameters.Add("@CreateTime", SqlDbType.DateTime).Value = DateTime.Now;
//                cmd.Parameters.Add("@Status", SqlDbType.Int).Value = (int)Enum_ApplyStatus.申请中;
//                cmd.Parameters.Add("@CreateUserID", SqlDbType.NVarChar).Value = param.LoginID;
//                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
//            }
//        }

//        /// <summary>
//        /// 获取用户信息
//        /// </summary>
//        /// <param name="LoginID"></param>
//        /// <returns></returns>
//        public static DataSet GetLoginIDMassage(string LoginID)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                string sql = string.Format(@"select * from tblPartyOrgMembers where LoginID='{0}'", LoginID);
//                cmd.CommandText = sql;
//                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
//            }
//        }

//        /// <summary>
//        /// 插入流程表
//        /// </summary>
//        /// <param name="omodel"></param>
//        public static bool InsertLinkExample(string AppllicationID, string LoginID, string LoginName)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                StringBuilder sbsql = new StringBuilder();
//                sbsql.Append(@"INSERT INTO [tblPartyJoinLinkExample]
//                               ([StandID]
//                               ,[AppllicationID]
//                               ,[CurrentStepID]
//                               ,[CurrentStepName]
//                               ,[HandleUserID]
//                               ,[HandleUserName]
//                               ,[HandleTime]
//                               ,[Status]
//                               ,[IsEffective]
//                               ,[OrderNo])
//                                VALUES(@StandID,@AppllicationID,@CurrentStepID,@CurrentStepName,@HandleUserID,
//                                @HandleUserName,@HandleTime,@Status,@IsEffective,@OrderNo)");
//                cmd.Parameters.Add("@StandID", SqlDbType.NVarChar).Value = StringHelper.NewID;
//                cmd.Parameters.Add("@AppllicationID", SqlDbType.NVarChar).Value = AppllicationID;
//                cmd.Parameters.Add("@CurrentStepID", SqlDbType.NVarChar).Value = "JoinStep1";
//                cmd.Parameters.Add("@CurrentStepName", SqlDbType.NVarChar).Value = "入党申请";
//                cmd.Parameters.Add("@HandleUserID", SqlDbType.NVarChar).Value = LoginID;
//                cmd.Parameters.Add("@HandleUserName", SqlDbType.NVarChar).Value = LoginName;
//                cmd.Parameters.Add("@HandleTime", SqlDbType.DateTime).Value = DateTime.Now;
//                cmd.Parameters.Add("@Status", SqlDbType.NVarChar).Value = (int)Enum_FlowStanceStatus.通过;
//                cmd.Parameters.Add("@IsEffective", SqlDbType.NVarChar).Value = "1";
//                cmd.Parameters.Add("@OrderNo", SqlDbType.Int).Value = 0;
//                cmd.CommandText = sbsql.ToString();
//                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;

//            }
//        }

//    }
//}